package homework3.exp4;

import homework3.exp3.Student;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.lang.reflect.Method;


public class Test4 {

	public static void main(String[] args) {
		ObjectInputStream ois = null;
		try {
			ois = new ObjectInputStream(new FileInputStream("D:\\SerializableObj.txt"));
			Student stu = (Student)ois.readObject();
			System.out.println("姓名为："+stu.getName());
			System.out.println("年龄为："+stu.getNumber());
			System.out.println("性别为："+stu.getGender());
		} catch(IOException ex) {
			ex.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} finally {
			if(ois!=null) {
				try {
					ois.close();
				} catch(IOException e) {
					e.printStackTrace();
				}
			}
		}
	}

}
